<?php

namespace Boosen\Admin\EmailAlert;

use Encore\Admin\Admin;
use Encore\Admin\Auth\Database\Menu;
use Encore\Admin\Extension;

class EmailAlert extends Extension
{
	/**
     * Bootstrap this package.
     *
     * @return void
     */
    public static function boot()
    {
        static::registerRoutes();

        Admin::extend('email_alert', __CLASS__);
    }

    public static function registerRoutes()
    {
        parent::routes(function ($router) {
            /* @var \Illuminate\Routing\Router $router */
            $router->resource(
                'boosen/templates',
                'Boosen\Admin\EmailAlert\Controllers\TemplateController'
            );

            $router->get('boosen/email/sending', 'Boosen\Admin\EmailAlert\Controllers\EmailSendingController@show')->name('email.show');
            $router->post('boosen/email/sending', 'Boosen\Admin\EmailAlert\Controllers\EmailSendingController@send')->name('email.send');
            $router->get('boosen/email/template', 'Boosen\Admin\EmailAlert\Controllers\EmailSendingController@template')->name('email.template');
        });
    }

    public static function import()
    {
    	parent::createMenu('Email Templates', 'boosen/templates', 'fa-toggle-on');

        parent::createPermission('Boosen templates', 'ext.templates', 'templates*');
    }
}